package com.shark.commons.base.web;


/**
 * Ajax DTO
 * @author yhaoquan
 *
 * @param <T>
 */
public class AjaxResult<T> {

	private boolean status ;
	
	private String message ;
	
	private T data ;
	
	private Object obj ;

	public AjaxResult() {}
	
	public AjaxResult(boolean status, T data) {
		super();
		this.status = status;
		this.data = data;
	}

	public AjaxResult(boolean status, String message) {
		super();
		this.status = status;
		this.message = message;
	}

	public AjaxResult(boolean status, String message, T data) {
		super();
		this.status = status;
		this.message = message;
		this.data = data;
	}

	public Object getObj() {
		return obj;
	}

	public void setObj(Object obj) {
		this.obj = obj;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
	
	public static AjaxResult<Object> failed(String message) {
        return new AjaxResult<Object>(Boolean.FALSE, message);
    }
	
	public static AjaxResult<Object> success(String message) {
		return new AjaxResult<Object>(Boolean.TRUE, message);
	}
	
}
